package com.cs.study.homework._0223.Shop.view;

import com.cs.study.homework._0223.Shop.model.Book;

import java.util.Scanner;

/**
 * @description:
 * @author: 景天
 * @date: 2024/2/23 14:41
 **/

// 书籍视图 展示书籍信息
public class BookView {
    //
    private static Scanner scanner = new Scanner(System.in);

    public void displayInfo(Book book) {
        System.out.println("书籍信息:");
        System.out.println("书名:" + book.getBookName());
        System.out.println("作者:" + book.getAuthor());
        System.out.println("价格:" + book.getPrice());
    }

    // 获取用户输入信息
    public Book getUserInput() {
        System.out.println("输入要更新的信息:");
        System.out.println("请输入书名:");
        String bookName = scanner.nextLine();
        System.out.println("请输入作者:");
        String author = scanner.nextLine();
        System.out.println("请输入价格:");
        String price = scanner.nextLine();
        System.out.println("请输入书本编号:");
        String bookId = scanner.nextLine();

        // 把信息封装成对象
        Book book = new Book(bookName,Integer.parseInt(bookId), author, Double.parseDouble(price));
        return book;
    }

    public void updateInfo() {
        System.out.println("update success!");

    }

    public int getUserDelete(){
        System.out.println("输入你要删除书本信息：");
        System.out.println("请输入你要删除的书本的编号：");
        String bookId = scanner.nextLine();
        return 0;
    }
    public void deleteInfo(){
        System.out.println("update success!");
    }
}
